<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>“爸爸的选择”纸尿裤免费送！</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <link href="/res/plugins/activity/common/css/main.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/res/plugins/activity/common/css/animate.min.css"/>
    <link rel="stylesheet" href="/res/plugins/activity/common/css/common.css"/>
    <script type="text/javascript" src="/res/plugins/activity/common/js/jquery-1.9.1.min.js"></script>

    <!--弹窗样式-->
    <script type="text/javascript" src="/res/plugins/activity/common/js/jquery.min.js"></script>
    <script type="text/javascript" src="/res/plugins/activity/common/js/jquery.form.js"></script>
    <script type="text/javascript" src="/res/plugins/activity/common/js/tooltips.js"></script>
    <!--微信分享-->
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <style>
        #HBox{
            height: 445px;
            margin-top: -195px;
        }
    </style>
</head>
<body >

<div class="water content">
    <img class="lazy" src="/res/plugins/activity/bbdxz/images/1.png" />
    <img class="lazy" src="/res/plugins/activity/bbdxz/images/2.png" />
    <img class="lazy" src="/res/plugins/activity/bbdxz/images/3.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/4.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/5.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/6.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/7.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/8.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/9.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/10.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/11.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/12.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/13.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/14.png" />
    <img class="lazy" data-original="/res/plugins/activity/bbdxz/images/15.png" />
</div>
<div id="HBox">
    <form action="" method="post" >
        <a id="HCloseBtn" title="关闭"><span>×</span></a>
        <ul class="list">
           <li>
              <input type="text"  value="同一个地址、姓名、手机只能领取一次噢" readonly  class="ipt nickname" style="border-bottom:none"/>
            </li>
            <li>
                <div class="fl">
                    <input type="text" name="nickname" id="" value="" placeholder="请输入姓名" required class="ipt nickname" />                  </div>
            </li>
            <li>
                <div class="fl">
                    <input type="text" name="phone" value="" placeholder="请输入手机号" required class="ipt phone" />                       </div>
            </li>
            <li>
                <div class="fl">
                    <input type="text" name="captcha" value="" placeholder="请输入验证码" required class="ipt phone" />                       </div>
                <div style="background-color: #47B9CA;width: 60px;border-radius: 20px;text-align: center;position: fixed;right: 26px;margin-top: 7px;line-height: 2.0">
                    <a href="javascript:;" class="button" id="sendSms" onclick="send()"  style="font-size: 83%">验证码</a>
                </div>
            </li>
            <li>
                <div class="col-sm-9">
                    <select name="province" id="sel-provance" onChange="selectCity();" class="pull-left form-control" style="width:30%; margin-right:5%;">
                        <option value="" selected="true">省/直辖市</option>
                    </select>
                    <select name="city" id="sel-city" onChange="selectcounty()" class="pull-left form-control" style="width:30%; margin-right:5%;">
                        <option value="" selected="true">请选择</option>
                    </select>
                    <select name="area" id="sel-area" class="pull-left form-control" style="width:30%;">
                        <option value="" selected="true">请选择</option>
                    </select>
                </div>
            </li>
            <li><input type="text" name="address" placeholder="详细地址(请勿重复填写省市区)" required class="ipt address" id="address"></li>
            <li>
                <select name="size">
                    <option value="">请选择型号</option>
                    <option value="S">S</option>
                    <option value="M">M</option>
                    <option value="L">L</option>
                    <option value="XL">XL</option>
                </select>
            </li>
            <li><input value="确认提交" class="submitBtn" readonly style="background-color: #47B9CA;"/></li>
        </ul>
    </form>
</div><!-- HBox end -->
<div class="bounceIn dialog footer" style="background-color: #47B9CA;">免费领取</div>
<script src="/res/plugins/activity/common/js/jquery.hDialog.min.js"></script>
<script src="/res/plugins/activity/common/js/jquery.lazyload.js"></script>
<script type="text/javascript" src="/res/plugins/activity/common/js/cascade.js?x=15"></script>
<script>
    var countdown=5;
    //发送验证码
    function send(){
        settime();
        var testphone = /^0?(13[0-9]|15[0-9]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/;
        var phone = $("input[name='phone']").val();
        if (!testphone.test(phone)){
            show_err_msg('请输入正确手机号');
            return;
        }
        $.ajax({
            url: "/shop/activity/getCaptcha",
            type: 'GET',
            data:{
                "phone": phone
            },
            success: function(data){
                if (data.code == 0){
                    show_err_msg("验证码发送成功");
                    settime();
                }else if (data.code == 1){
                    show_err_msg(data.desc);
                }
            }});
    }
    var countdown=300;
    var timeid = 0;
    function settime() {
        if (countdown == 0) {
            $("#sendSms").attr("onclick","send();");
            $("#sendSms").html("验证码");
            clearTimeout(timeid);
            return;
        } else {
            $("#sendSms").removeAttr('onclick');
            $("#sendSms").html("(" + countdown + ")");
            countdown--;
        }
        alert(timeid);
        timeid = setTimeout(function() {
            settime()
        },1000)
    }

    $(function(){
        cascdeInit('/res/plugins/activity/common/js','','','');
        $("img.lazy").lazyload({
            effect: "fadeIn"
        });
        var $el = $('.dialog');
        $el.hDialog(); //默认调用
        $('.dialog').hDialog(); //打开效果调用
        //返回顶部
        $.goTop();
        //提交并验证表单
        $('.submitBtn').click(function() {
            var PhoneReg = /^0?(13[0-9]|15[0-9]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/ ; //手机正则
            var NicknameReg=/^[\u4e00-\u9fa5]+$/ ;
            var nickname = $("input[name='nickname']").val();
            var phone = $("input[name='phone']").val();
            var captcha=$("input[name='captcha']").val();
            var province=$("select[name='province']").val();
            var city=$("select[name='city']").val();
            var area=$("select[name='area']").val();
            var address=$("input[name='address']").val();
            var size=$("select[name='size']").val();

            if(!nickname){
                show_err_msg('姓名还没填呢...');
                return;
            }else if(!NicknameReg.test(nickname)){
                show_err_msg('姓名只能为汉字...');
                return;
            }else if(!phone){
                show_err_msg('手机还没填呢...');
                return;
            }else if(!PhoneReg.test(phone)){
                show_err_msg('手机格式错咯...');
                return;
            }else if(!(captcha)){
                show_err_msg('验证码还没填呢...');
                return;
            }else if(!address){
                show_err_msg('详细地址还没填呢...');
                return;
            }else if(!size){
                show_err_msg('型号还没填呢...');
                return;
            }
            $.ajax({
                url: "${weburl}/shop/activity/bbdxz",
                type: 'GET',
                data:{
                    "nickname":nickname,
                    "phone":phone,
                    "captcha":captcha,
                    "province":province,
                    "city":city,
                    "area":area,
                    "address":address,
                    "size":size,
                },
                success: function(data){
                    if(data.code == 1){
                        //注册错误
                        show_err_msg(data.desc);
                    }else if (data.code == 0){
                        show_err_msg('恭喜您报名成功');
                        setTimeout(function(){
                            $("#HBox").hide();
                            $("#HOverlay").hide();
                        },2500);

                    }
                }});
        });
    });

    wx.config({
        debug: false,
        appId : '${appId}',
        timestamp : '${timestamp}',
        nonceStr : '${nonceStr }',
        signature : '${signature}',
        jsApiList : [ 'onMenuShareTimeline', 'onMenuShareAppMessage',
            'onMenuShareQQ', ]
    });
    wx.ready(function() {
        /* 发送给朋友 */
        wx.onMenuShareAppMessage({
            title: '“爸爸的选择”纸尿裤免费送！',
            desc: '“爸爸的选择”纸尿裤免费试用，人人有份，赶快来领取吧！！',
            link: '${weburl}/shop/activity/bbdxzform',
            imgUrl: '${weburl}/res/plugins/activity/bbdxz/images/bbdxz_activity.png',
            fail: function (res) {
                alert(JSON.stringify(res));
            }
        });
        /* 分享到朋友圈 */
        wx.onMenuShareTimeline({
            title: '“爸爸的选择”纸尿裤免费试用，人人有份，赶快来领取吧！！',
            link: '${weburl}/shop/activity/bbdxzform',
            imgUrl: '${weburl}/res/plugins/activity/bbdxz/images/bbdxz_activity.png',
            fail: function (res) {
                alert(JSON.stringify(res));
            }
        });
        /* 分享到QQ */
        wx.onMenuShareQQ({
            title: '“爸爸的选择”纸尿裤免费送！',
            desc: '“爸爸的选择”纸尿裤免费试用，人人有份，赶快来领取吧！！',
            link: '${weburl}/shop/activity/bbdxzform',
            imgUrl: '${weburl}/res/plugins/activity/bbdxz/images/bbdxz_activity.png',
            complete: function (res) {
                alert(JSON.stringify(res));
            },
            fail: function (res) {
                alert(JSON.stringify(res));
            }
        });
        /*分享到微博*/
        wx.onMenuShareWeibo({
            title: '“爸爸的选择”纸尿裤免费送！',
            desc: '“爸爸的选择”纸尿裤免费送！',
            link: '${weburl}/shop/activity/bbdxzform',
            imgUrl: '${weburl}/res/plugins/activity/bbdxz/images/bbdxz_activity.png',
            complete: function (res) {
                alert(JSON.stringify(res));
            },
            fail: function (res) {
                alert(JSON.stringify(res));
            }
        });
    });

</script>
</body>
</html>
